﻿using System.Collections.Generic;

namespace Multiprocessing.Core.Mathematics.Matrices
{
    public class ColumnCollection : PartCollection<MatrixColumn>
    {
        public ColumnCollection(IMatrix parent) 
            : base(parent)
        {
        }

        protected override MatrixColumn GetItem(int index)
        {
            return new MatrixColumn(this.Parent, index);
        }

        public override IEnumerator<MatrixColumn> GetEnumerator()
        {
            for ( int column = 0; column < this.Parent.ColumnCount; ++ column)
            {
                yield return GetItem(column);
            }
        }
    }
}
